/**
 * @description 商品的上架单据管理
 */
import request from '@/utils/request'

/**
 * @description 获取商品上架单据列表
 * @param {Object} params
 * @returns {Promise}
 */
export const getGoodsSalesList = (data) => {
  return request({
    url: '/dealer/pzSalesRequestM/getDealerPzSalesRequestMByCondition',
    method: 'post',
    data,
  })
}

/**
 * @description 根据id删除商品上架单据
 * @param {Object} params
 * @returns {Promise}
 */
export const deleteGoodsSales = (id) => {
  return request({
    url: `/dealer/pzSalesRequestM/deleteSalesRequestMById?salesRequestMId=${id}`,
    method: 'post',
  })
}

/**
 * @description 保存商品上架单据
 * @param {Object} params
 * @returns {Promise}
 */
export const saveGoodsSales = (params) => {
  return request({
    url: `/dealer/pzSalesRequestM/saveSalesRequestM`,
    method: 'post',
    data: params,
  })
}

/**
 * @description 根据id查看上架单据
 * @param {Object} params
 * @returns {Promise}
 */
export const getGoodsSalesDetail = (id) => {
  return request({
    url: `/dealer/pzSalesRequestM/viewPzSalesRequestMById?salesRequestMId=${id}`,
    method: 'post',
  })
}

/**
 * @description 获取库存信息（用于上架单据的库存信息）
 * @param {Object} params
 * @returns {Promise}
 */
export const getStockInfo = (data) => {
  return request({
    url: `/dealer/pzDealerGoodsStore/getDealerGoodsStoreListByConditionForRequest`,
    method: 'post',
    data,
  })
}
